package com.chushouya.common.util;

import com.chushouya.common.constant.Constants;
import org.apache.commons.codec.digest.DigestUtils;

public class PasswordUtil {

    public static String encryptPassword(String password) {
        return DigestUtils.md5Hex(DigestUtils.sha1Hex(password) + Constants.PWD_SALT);

    }

    public static boolean matchesPassword(String password, String encryptPassword) {
        return encryptPassword(password).equals(encryptPassword);

    }

    public static void main(String[] args) {
        System.out.println(PasswordUtil.encryptPassword("123456"));
    }

}
